package com.zmq.pic.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * 用户 entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "pic_user")
public class PicUser extends com.zmq.pic.entity.BaseEntity implements
		java.io.Serializable {

	private static final long serialVersionUID = 6512884353173371580L;
	// Fields
	private Long id;
	/**
	 * 用户名
	 */
	private String userName;
	/**
	 * 密码
	 */
	private String password;
	/**
	 * 用户信息
	 */
	private PicUserinfo picUserinfo;
	private Set<PicUserRole> picUserRoles = new HashSet<PicUserRole>(0);
	private Set<PicUserFigure> picUserFigures = new HashSet<PicUserFigure>(0);

	// Constructors

	/** default constructor */
	public PicUser() {
	}

	/** minimal constructor */
	public PicUser(String userName, String password) {
		this.userName = userName;
		this.password = password;
	}

	/** full constructor */
	public PicUser(String userName, String password, PicUserinfo picUserinfo,
			Set<PicUserRole> picUserRoles, Set<PicUserFigure> picUserFigures) {
		this.userName = userName;
		this.password = password;
		this.picUserinfo = picUserinfo;
		this.picUserRoles = picUserRoles;
		this.picUserFigures = picUserFigures;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ID", nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "USER_NAME", nullable = false, length = 64)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "PASSWORD", nullable = false, length = 64)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "picUser")
	public PicUserinfo getPicUserinfo() {
		return this.picUserinfo;
	}

	public void setPicUserinfo(PicUserinfo picUserinfo) {
		this.picUserinfo = picUserinfo;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "picUser")
	public Set<PicUserRole> getPicUserRoles() {
		return this.picUserRoles;
	}

	public void setPicUserRoles(Set<PicUserRole> picUserRoles) {
		this.picUserRoles = picUserRoles;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "picUser")
	public Set<PicUserFigure> getPicUserFigures() {
		return this.picUserFigures;
	}

	public void setPicUserFigures(Set<PicUserFigure> picUserFigures) {
		this.picUserFigures = picUserFigures;
	}

	@Override
	public String toString() {
		return "PicUser [id=" + id + ", password=" + password
				+ ", picUserFigures=" + picUserFigures + ", picUserRoles="
				+ picUserRoles + ", picUserinfo=" + picUserinfo + ", userName="
				+ userName + "]";
	}
	

}